package com.yuyou.fn.educational.vo;


import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yuyou.fn.common.util.Principals;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

public class ConfirmPayInfo {



    public static class Pay{
        //支付方式：0-现金；1-刷卡；2-转账；3-账户 4-在线支付
        @NotNull
        private Integer payWay ;

        @NotNull
        @DecimalMin("0")
        private BigDecimal amount ;

        public Integer getPayWay() {
            return payWay;
        }

        public Pay(){}

        public void setPayWay(Integer payWay) {
            this.payWay = payWay;
        }

        public BigDecimal getAmount() {
            return amount;
        }

        public void setAmount(BigDecimal amount) {
            this.amount = amount;
        }
    }

    private Long requestPayId ;

    @NotNull()
    private Long courseOrderId ;

    @NotNull
    @Valid
    private List<Pay> pays ;

    private BigDecimal payAmount ;

    @NotNull
    private Long chargeCampusId ;

    @NotNull
    @Valid
    private List<PayLecture> payLectures ;

    @NotNull
    private Long counselorId;

    public boolean containsPosPay() {

        if(this.getPays() == null || this.getPays().isEmpty() ){
            return false ;
        }

        for(Pay pay : this.pays ){
            if(pay.payWay == 1){
                return true ;
            }
        }
        return false ;
    }


    private Principals.Principal principal ;

    public Principals.Principal getPrincipal() {
        return principal;
    }

    public void setPrincipal(Principals.Principal principal) {
        this.principal = principal;
    }

    public Long getRequestPayId() {
        return requestPayId;
    }

    public void setRequestPayId(Long requestPayId) {
        this.requestPayId = requestPayId;
    }

    public Long getCourseOrderId() {
        return courseOrderId;
    }

    public void setCourseOrderId(Long courseOrderId) {
        this.courseOrderId = courseOrderId;
    }

    public BigDecimal getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
    }

    public List<Pay> getPays() {
        return pays;
    }

    public void setPays(List<Pay> pays) {
        this.pays = pays;
    }

    public Long getChargeCampusId() {
        return chargeCampusId;
    }

    public void setChargeCampusId(Long chargeCampusId) {
        this.chargeCampusId = chargeCampusId;
    }

    public List<PayLecture> getPayLectures() {
        return payLectures;
    }

    public void setPayLectures(List<PayLecture> payLectures) {
        this.payLectures = payLectures;
    }

    public Long getCounselorId() {
        return counselorId;
    }

    public void setCounselorId(Long counselorId) {
        this.counselorId = counselorId;
    }



}
